<?php

/**
 * filterspec form base class.
 *
 * @method filterspec getObject() Returns the current form's model object
 *
 * @package    forumCDE
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasefilterspecForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'owner_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('owner'), 'add_empty' => true)),
      'ownerclass'          => new sfWidgetFormInputText(),
      'className'           => new sfWidgetFormInputText(),
      'fieldName'           => new sfWidgetFormInputText(),
      'operator'            => new sfWidgetFormInputText(),
      'valueFrom'           => new sfWidgetFormInputText(),
      'valueUntil'          => new sfWidgetFormInputText(),
      'connector'           => new sfWidgetFormInputText(),
      'warningText'         => new sfWidgetFormInputText(),
      'whereText'           => new sfWidgetFormInputText(),
      'whereParams'         => new sfWidgetFormInputText(),
      'joinAliasNumber'     => new sfWidgetFormInputText(),
      'joinTableName'       => new sfWidgetFormInputText(),
      'joinTableDescriptor' => new sfWidgetFormInputText(),
      'relationName'        => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'owner_id'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('owner'), 'required' => false)),
      'ownerclass'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'className'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'fieldName'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'operator'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'valueFrom'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'valueUntil'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'connector'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'warningText'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'whereText'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'whereParams'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'joinAliasNumber'     => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'joinTableName'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'joinTableDescriptor' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'relationName'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('filterspec[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'filterspec';
  }

}
